CPP=g++
OBJ=config.o configtest.o rtp.o rtptest.o portmanager.o portmanagertest.o tester.o
BIN=DaemonTest
LIBS=-pthread -lortp -lcppunit -ldl
CXXINCS=-I"../"
CXXFLAGS=$(CXXINCS) -D_DEBUG -Wall -pedantic -Wno-long-long
RM=rm -f

.PHONY: all all-before all-after clean clean-custom

all: all-before $(BIN) all-after

clean: clean-custom
	${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
	$(CPP) $(OBJ) -o $(BIN) $(LIBS)

config.o: ../Config.cpp ../Config.h ../Debug.h
	$(CPP) -c ../Config.cpp -o config.o $(CXXFLAGS)

configtest.o: ConfigTest.cpp ConfigTest.h ../Config.h
	$(CPP) -c ConfigTest.cpp -o configtest.o $(CXXFLAGS)

rtp.o: ../Rtp.cpp ../Rtp.h
	$(CPP) -c ../Rtp.cpp -o rtp.o $(CXXFLAGS)

rtptest.o: RtpTest.cpp RtpTest.h ../Rtp.h
	$(CPP) -c RtpTest.cpp -o rtptest.o $(CXXFLAGS)

portmanager.o: ../PortManager.cpp ../PortManager.h ../Config.h
	$(CPP) -c ../PortManager.cpp -o portmanager.o $(CXXFLAGS)

portmanagertest.o: PortManagerTest.cpp PortManagerTest.h ../PortManager.h
	$(CPP) -c PortManagerTest.cpp -o portmanagertest.o $(CXXFLAGS)

tester.o: tester.cpp
	$(CPP) -c tester.cpp -o tester.o $(CXXFLAGS)
